import request from '@/utils/request'

// 查询销售订单信息列表
export function listOrder(query) {
  return request({
    url: '/sales/order/list',
    method: 'post',
    data: query
  })
}

// 查询销售冻结明细信息列表
export function listOrderFreeze(query) {
  return request({
    url: '/sales/order/listFreeze',
    method: 'post',
    data: query
  })
}

// 查询销售订单信息详细
export function getOrder(id) {
  return request({
    url: '/sales/order/' + id,
    method: 'get'
  })
}

// 新增销售订单信息
export function addOrder(data) {
  return request({
    url: '/sales/order/add',
    method: 'post',
    data: data
  })
}

// 修改销售订单信息
export function updateOrder(data) {
  return request({
    url: '/sales/order/edit',
    method: 'post',
    data: data
  })
}
// 修改销售订单仓库信息
export function updateOrderWareHouse(data) {
  return request({
    url: '/sales/order/editWareHouse',
    method: 'post',
    data: data
  })
}

// 修改销售订单仓库信息
export function updatLogisticsNameBatch(data) {
  return request({
    url: '/sales/order/updatLogisticsNameBatch',
    method: 'post',
    data: data
  })
}

// 修改销售订单信息
export function editSku(data) {
  return request({
    url: '/sales/order/editSku',
    method: 'post',
    data: data
  })
}

// 删除销售订单信息
export function delOrder(id) {
  return request({
    url: '/sales/order/delete/' + id,
    method: 'post'
  })
}

// 查询销售订单状态统计信息
export function findOrderStatusCount(query) {
  return request({
    url: '/sales/order/findOrderStatusCount',
    method: 'post',
    data: query
  })
}

// 审核
export function auditOrder(id) {
  return request({
    url: '/sales/order/audit/' + id,
    method: 'post'
  })
}

//结算
export function settleOrders(ids){
  return request({
    url: '/sales/order/settle/' + ids,
    method: 'post'
  })
}

// 取消审核
export function auditOrderCancel(id) {
  return request({
    url: '/sales/order/auditCancel/' + id,
    method: 'post'
  })
}

// 发货
export function sendOrder(id) {
  return request({
    url: '/sales/order/send/' + id,
    method: 'post'
  })
}

// 发货
export function updateLogistics(id) {
  return request({
    url: '/sales/order/updateLogistics/' + id,
    method: 'post'
  })
}

// 订单关闭
export function closeOrder(data) {
  return request({
    url: '/sales/order/close',
    method: 'post',
    data: data
  })
}

// 订单发货退回
export function sendBack(data) {
  return request({
    url: '/sales/order/sendBack',
    method: 'post',
    data: data
  })
}

// 修改时查询销售订单信息详细
export function getOrderByEdit(id) {
  return request({
    url: '/sales/order/getInfoByEdit/' + id,
    method: 'get'
  })
}

// 查询销售订单数量
export function findCount(query) {
  return request({
    url: '/sales/order/findCount',
    method: 'post',
    data: query
  })
}

// 订单更新物流发货
export function sendOrderByLogistic(data) {
  return request({
    url: '/sales/order/sendOrderByLogistic',
    method: 'post',
    data: data
  })
}

// 获取省份列表
export function listDistinctAddress(data) {
  return request({
    url: '/sales/order/listDistinctAddress',
    method: 'post',
    data: data
  })
}
